package cn.com.headfree.mouldshow.dao.impl;

import cn.com.headfree.entity.TTecManInnovTemp;
import cn.com.headfree.mouldshow.dao.TTecManInnovTempDao;
import com.gta.edu.sdk.base.dao.impl.BaseDaoImpl;
import org.springframework.stereotype.Repository;

import java.sql.Timestamp;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

@Repository("/tTecManInnovTempDao")
public class TTecManInnovTempDaoImpl extends BaseDaoImpl<TTecManInnovTemp> implements TTecManInnovTempDao {


    @Override
    public void saveInfo(TTecManInnovTemp tTecManInnov) {
        String sql = "insert into t_tec_man_innov_temp (id,achi_name,achi_type,summary,award_name,award_date,award_org,award_level,award_grade,group_name,member_name,org_id,creater_id,creater_name,create_time,updater_id,updater_name,update_time,del_sign,is_valid,audit_state,orignal_id,business_type_id,primitive_id) values ";
        StringBuilder sqlBuilder = new StringBuilder(sql);
        sqlBuilder.append("(#{id,jdbcType=VARCHAR},").append("#{achi_name,jdbcType=VARCHAR},").append("#{achi_type,jdbcType=VARCHAR},")
                .append("#{summary,jdbcType=VARCHAR},").append("#{award_name,jdbcType=VARCHAR},")
                .append("#{award_date,jdbcType=VARCHAR},").append("#{award_org,jdbcType=VARCHAR},")
                .append("#{award_level,jdbcType=DATE},").append("#{award_grade,jdbcType=DATE},")
                .append("#{group_name,jdbcType=DATE},").append("#{member_name,jdbcType=DATE},")
                .append("#{org_id,jdbcType=DATE},").append("#{creater_id,jdbcType=DATE},").append("#{creater_name,jdbcType=DATE},")
                .append("#{create_time,jdbcType=DATE},").append("#{updater_id,jdbcType=VARCHAR},")
                .append("#{updater_name,jdbcType=VARCHAR},").append("#{update_time,jdbcType=DATE},")
                .append("#{del_sign,jdbcType=INTEGER},").append("#{is_valid,jdbcType=INTEGER},")
                .append("#{audit_state,jdbcType=INTEGER},").append("#{orignal_id,jdbcType=VARCHAR},")
                .append("#{business_type_id,jdbcType=VARCHAR},").append("#{primitive_id,jdbcType=VARCHAR})");
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("id", tTecManInnov.getId());
        params.put("achi_name", tTecManInnov.getAchiName());
        params.put("achi_type", tTecManInnov.getAchiType());
        params.put("summary", tTecManInnov.getSummary());
        params.put("award_name", tTecManInnov.getAwardName());
        params.put("award_date", tTecManInnov.getAwardDate());
        params.put("award_org", tTecManInnov.getAwardOrg());
        params.put("award_level", tTecManInnov.getAwardLevel());
        params.put("award_grade", tTecManInnov.getAwardGrade());
        params.put("group_name", tTecManInnov.getGroupName());
        params.put("member_name", tTecManInnov.getMemberName());
        params.put("org_id", tTecManInnov.getOrgId());
        params.put("creater_id", tTecManInnov.getCreaterId());
        params.put("creater_name", tTecManInnov.getCreaterName());
        params.put("create_time", new Timestamp(new Date().getTime()));
        params.put("updater_id", tTecManInnov.getUpdaterId());
        params.put("updater_name", tTecManInnov.getUpdaterName());
        params.put("update_time", new Timestamp(new Date().getTime()));
        params.put("del_sign", 0);
        params.put("is_valid", tTecManInnov.getIsValid());
        params.put("audit_state", tTecManInnov.getAuditState());
        params.put("orignal_id", tTecManInnov.getOrignalId());
        params.put("business_type_id", tTecManInnov.getBusinessTypeId());
        params.put("primitive_id", tTecManInnov.getPrimitiveId());
        this.executeSql(sqlBuilder.toString(), params);

    }
}
